<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>首页</title>
<%@ include file="/pages/inc/taglibs.jsp"%>
<%@ include file="/pages/inc/header.jsp"%>
<%@ include file="/pages/inc/common.jsp"%>
</head>
<body>
<div class="container-fluid">
    <div class="barTitle">
        <span>项目工时</span>
    </div>
    <table class="table">
			<tbody>
				<tr>
					<td class="inputLabelTd">项目：</td>
					<td class="inputTd"><select id="projectSelect"
						name="projectSelect" class="select" onchange = ></select></td>
				</tr>
	</table>
	<input type="hidden" id="projectId" value ="">
	</div>
<div class="container-fluid">
	
  <div class="row-fluid" style=" height: 300px;margin:20px 0 20px 0">
    <div class="span12" id="span10_div" style="background-color: #FFFFFF;height:100%;">
    <table id="projectWHListGrid"></table>
	<div id="projectWHListGrid_prowed"></div>
    </div>
  </div>
</div>

<script type="text/javascript">
new biz.select({
    id:"#projectSelect",
    url:"<c:url value="/deduction/project/list" />",
    onchange:function(e,data) {
        $("#projectId").val(data.value);
        projectWHListGrid.setGridParam({postData:{"projectId":$("#projectId").val()}});
        projectWHListGrid.trigger('reloadGrid');
    }
});


/*
加载服务器端响应的数据
*/
var projectWHListGrid = new biz.grid({
	id:"#projectWHListGrid",
	url: "<c:url value='/company/project/workhour/list' />",/*必需，grid初始化时请求数据的远程url*/
	datatype: "json",/*必需，请求服务器端数据时，数据类型需设为json*/
	editurl:"<c:url value='/company/project/edit' />" ,/*新增、编辑、删除数据时提交到的url*/
	postData:{"projectId":$("#projectId").val()},
	colModel:[
	    {name:'id',index:'id', label:"id",width:75,sortable:false,key:true,hidden:true},
	    {name:'wbsName',index:'wbsName',label:"项目阶段", width:100,editable:true,editoptions:{readonly:false},formoptions:{ rowpos:1, colpos:1}},
	    {name:'employeeName',index:'employeeName',label:"员工姓名", width:50, align:"right",editrules:{required:true},editable:true,formoptions:{ rowpos:2, colpos:1}},
	    {name:'workHours',index:'workHours',label:"工时（小时）", width:50, align:"right",editrules:{required:true},editable:true,formoptions:{ rowpos:6, colpos:1}}
	],
	navtype:"top",
	navopt:{view:true,edit:true,add:true,del:false}/*导航栏属性设置：哪些按钮显示*/,
	pager: '#projectWHListGrid_prowed',
	
	}).navButtonAdd('#projectWHListGrid_toppager',{ //增加按钮api
	    caption:"删除", // 按钮名
	    buttonicon:"ui-icon-trash", //按钮图标
	    position:"last",
	    onClickButton: function(){ //按钮单击事件
	    	new biz.alert({type:"confirm",message:"确定要删除？",title:"删除确认"
	    		,callback:function(result){
		    		if (!result) {
		    			return;
		    		}
		    		var json = {};
		    		var condition = ""
		    		var rowids = projectWHListGrid.getGridParam('selarrrow');
		    		if(rowids.length==0){
		    			showInfo("请选择要删除的记录！");
		    			return;
		    		}else{
		    			condition = rowids.join(",");
			    	}
		    		json.ids = condition;
					$.ajax({
						type : "POST",
						url: "<c:url value='/company/project/delete'/>",
						cache:false,
						dataType : "json",
						data : json, 
						success: function(data){
							projectWHListGrid.trigger('reloadGrid');
						},
						error:function(data){
							alert("error");
						}
					});
				}
			});
	    }
	});
	
var taxArr = [
              {name:'费用化',value:'1'},
              {name:'资本化',value:'2'}
          ] ;
	var taxArr1 = [
	              {name:'自主',value:'1'},
	              {name:'委托',value:'2'},
	              {name:'合作',value:'3'},
	              {name:'集中',value:'4'}
	          ] ;
</script>
</body>
</html>